package com.jie.lipassword.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;
public class DbContect extends SQLiteOpenHelper {
    private static final int VERSION=1;
    private static final String DBNAME="MyPassword.db";   //  创建数据库名叫 Users
    private Context mContext;

    public DbContect(Context context){
        super(context,DBNAME,null,VERSION);
        mContext = context;
    }
    //创建数据库
    public void onCreate(SQLiteDatabase db){
        //创建类型表
        db.execSQL("CREATE TABLE TypeTable ( id INT PRIMARY KEY, type_name VARCHAR(255))");
        //创建用户名和密码表
        db.execSQL("CREATE TABLE PasswordParameters (id INT PRIMARY KEY, type_name VARCHAR(255), account VARCHAR(255), password VARCHAR(255), note Text DEFAULT NULL)");
    }
    //数据库版本更新
    public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion)
    {
        db.execSQL("drop table if exists TypeTable");
        db.execSQL("drop table if exists PasswordParameters");
        onCreate(db);
    }


}

